## Installation and Packaging
# Passes variables to the install script
install(
	CODE "
	set(SOURCE_DIR ${CMAKE_SOURCE_DIR})
    set(BUILD_DIR ${CMAKE_BUILD_DIR})	
	set(APPLICATION_NAME ${APPLICATION_NAME})
	set(APPLICATION_VERSION ${APPLICATION_VERSION})
	set(BUILD_TYPE ${CMAKE_BUILD_TYPE})
	set(BINARY_NAME ${BINARY_NAME})
	"
)

if (WIN32)
	# NSIS installer script
    # TODO: IF THIS IS NOT COMMENTED IT DOESN'T WORK WHEN RUNNING CMAKE FOR VS. THIS NEEDS TO BE FIXED
	INSTALL(FILES 
        ${QT_LIBRARY_DIR}/QtCore4.dll
        ${QT_LIBRARY_DIR}/QtGui4.dll
        ${QT_LIBRARY_DIR}/QtSql4.dll
        DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
    )
    INSTALL(FILES
        ${QT_PLUGINS_DIR}/sqldrivers/qsqlite4.dll
        DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sqldrivers
    )
	
	install(SCRIPT CMakeLists-install-windows.txt)
endif (WIN32)

if (APPLE)
	install(SCRIPT CMakeLists-install-macosx.txt)
endif (APPLE)

if (LINUX)
	install(SCRIPT CMakeLists-install-linux.txt)
endif (LINUX)
####
